package com.luowenbo.shortlink.separation.service.impl;

import com.luowenbo.shortlink.separation.entity.UrlMap;
import com.luowenbo.shortlink.separation.service.UrlMapService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.OffsetDateTime;
import java.util.List;

@Service
public class UrlMapServiceImpl implements UrlMapService{

    @Autowired
    private UrlMapInHotServiceImpl urlMapInHotService;

    @Autowired
    private UrLMapInColdServiceImpl urLMapInColdService;
            
    @Override
    public int findColdDataCountInHot(OffsetDateTime time) {
        return urlMapInHotService.findColdDataCountInHot(time);
    }

    @Override
    public int updateColdFlagInHot(OffsetDateTime time) {
        return urlMapInHotService.updateColdFlagInHot(time);
    }

    @Override
    public int AtomicUpdateLockThread(String threadName, OffsetDateTime time) {
        return urlMapInHotService.AtomicUpdateLockThread(threadName, time);
    }

    @Override
    public List<UrlMap> getDataByThread(String threadName) {
        return urlMapInHotService.getDataByThread(threadName);
    }

    @Override
    public int insertColdDataToColdDB(List<UrlMap> data) {
        return urLMapInColdService.insertColdDataToColdDB(data);
    }

    @Override
    public int deleteColdDataInHotDB(String name) {
        return urlMapInHotService.deleteColdDataInHotDB(name);
    }
}
